#ifndef _PACK_REQUEST_H_
#define _PACK_REQUEST_H_

#ifndef API
#include "net/net.h"
#endif

namespace pack {

class IPacket;

class Request {
	protected:
		uint32_t uri;
		uint32_t size;
		
	private:
		char* buf;
		uint32_t buf_size;

	protected:
		net::IBuffer* internal_buffer; /* 内部的Buffer */
		net::IBuffer* external_buffer; /* 指向外面的Buffer */

	public:
		Request(net::IBuffer* buffer);
		~Request();

	private: /* Internal */
		void DestroyBuf();
		void ReallocBuf(uint32_t size);

	public: /* External */
		uint32_t GetUri();

		bool GetPack(); /* 获取1个完整Packet，如果包不完整，返回false */
		bool Pack(IPacket* packet);
		bool UnPack(IPacket* packet);
};
	
}
#endif
